<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Flow</title>
    <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css" rel="stylesheet">
    <link rel="icon" href="/core/media/ui/flow_logo.png" type="image/png">
    <style>
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Roboto', sans-serif, 'Arial Narrow', Arial;
}

:root {
    --color-primary: #430474;
    --color-secondary: #f4b6ff;
    --color-accent: #8621b7;
    --color-highlight: #7d0ab6;
    --color-primary-text: #cba3e5;
    --color-border: #570d7b;
    --color-background: #181b1d;
    --color-background-secondary: #131312;
    --color-background-pattern: #4d0f7c;
    --color-header-background: #131312;
    --color-header-logo-text: #570d7b;
    --color-header-text:#570d7b;
    --color-social-icons: #570d7b;
    --color-button-primary: #570d7b; 
    --color-button-primary-hover: #8621b7; 
    --color-button-primary-text: #f4b6ff; 
    --color-button-primary-text-hover: #131312; 
    --color-button-primary-active: #8621b7; 
    --color-button-primary-text-active: #8621b7; 
    --color-button-secondary: #131312; 
    --color-button-secondary-hover: #8621b7; 
    --color-button-secondary-text: #f4b6ff; 
    --color-button-secondary-text-hover: #131312; 
    --color-button-secondary-active: #8621b7; 
    --color-button-secondary-text-active: #f4b6ff; 
    --color-progress-background: #2c063f;
    --color-progress-value:#7d0ab6;
    --color-scrollbar-track: #1e1e1f;
    --color-scrollbar-thumb: #570d7b;
    --color-input-range-thumb: #f4b6ff;
    --color-input-range-background: #570d7b;
    --color-spinner:#570d7b;
    --color-spinner-highlight:#7d0ab6;
}

html, body {
    background-color: #131312;
    height: 100%;
    margin: 0;
    padding: 0;
    background-color: var(--color-background);
    background-size: 32px 32px;
    background-image: radial-gradient(circle, var(--color-background-pattern) 1px, transparent 1px);
    color: var(--color-primary-text);
    overflow-x: hidden;
}

.container {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--color-background-secondary);   
    padding: 10px 50px 0 50px; 
    text-align: left;
    color: var(--color-primary);
    border-bottom: 1px dashed var(--color-background-pattern);
    position: relative;
}

#right-header {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-right: 10px;
    padding: 5px;
}

#Support {
    color: var(--color-header-text);
    margin: 10px;
    font-size: 12px;
}

a {
    text-decoration: none;
    color: var(--color-header-text);

}

header #logo {
    display: flex;
    justify-content: center;
    align-items: center;
}

header #img-logo {
    padding-right: 40px;
}

header .logo-text {
    display: inline-block;
    position: relative; 
    font-family: Arial; 
    cursor: pointer;
    color: var(--color-header-logo-text);
}

header .logo-text .text {
    overflow: hidden;
    font-size: 30px;
    text-align: center;
    display: inline-block;
    animation-name: animation-text;
    animation-duration: 2s;
}

header .left {
    position: absolute;
    left: -30px;
    font-size: 30px;
    line-height: 30px;
    animation-name: animation-left;
    animation-duration: 1.5s;
    font-weight: bold;
}

header .right {
    position: absolute;
    right: -30px;
    font-size: 30px;
    line-height: 30px;
    animation-name: animation-right;
    animation-duration: 1.5s;
    font-weight: bold;
}

#img-logo img {
    height: 40px;
    margin-right: 10px;
}

#status {
    font-size: 0.9em;
}

.main-wrapper {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.sidebar {
    width: 250px;
    background-color: var(--color-background-secondary);
    overflow-y: auto;
    padding: 20px 0;
    border-right: 1px dashed var(--color-border);
}

.menu-category {
    margin-bottom: 15px;
}

.menu-category > span {
    display: block;
    padding: 10px 20px;
    cursor: pointer;
    transition: background-color 0.3s;
    font-weight: bold;
}

.menu-category > a {
    display: block;
    padding: 10px 20px;
    cursor: pointer;
    transition: background-color 0.3s;
    font-weight: bold;
    text-decoration: none;
    color: var(--color-primary-text);
}

.menu-category > a:hover {
    background-color: var(--color-background-pattern);
}

.menu-category > span:hover {
    background-color: var(--color-background-pattern);
}

.menu-category > span i {
    margin-right: 10px;
    width: 20px;
    text-align: center;
}

.submenu {
    display: none;
    padding-left: 30px;
}

.submenu a {
    display: block;
    padding: 8px 10px;
    color: var(--color-primary-text);
    text-decoration: none;
    transition: background-color 0.3s;
}

.submenu a:hover {
    background-color: var(--color-background-secondary);
}

.content {
    flex: 1;
    display: flex;
    overflow: hidden;
}

.mid-col {
    padding: 10px;
    flex: 1;
    background-color: var(--color-background);
    border-radius: var(--border-radius);
    height: 100%;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--color-scrollbar-thumb) var(--color-scrollbar-track);        
}

.right-col {
    width: 200px;
    padding: 20px;
    overflow-y: auto;
}

footer {
    background-color: var(--color-background-secondary);
    color: var(--color-primary-text); 
    padding: 15px 50px;
    text-align: center;
    font-family: 'Gill Sans', 'Gill Sans MT', Calibri, 'Trebuchet MS', sans-serif;
    border-top: 1px dashed var(--color-primary); 
    margin-top: auto;
}

.flow-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    justify-content: start;
}

.flow-card {
    background-color: var(--color-background-secondary);
    border: 1px dashed var(--color-border);
    border-radius: var(--border-radius);
    overflow: hidden;
    transition: transform 0.3s, box-shadow 0.3s;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 250px;
    position: relative;
    transition: transform 0.5s ease;

}

.flow-card-content {
    position: relative;
    padding: 15px;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.flow-card img {
    width: 100%;
    height: 150px;
    object-fit: contain;
    background-color: var(--color-scrollbar-track);
    z-index: 1;
}

.flow-card h3 {
    margin-bottom: 10px;
    color: var(--color-primary-text);
    font-size: 1em;
}

.flow-card p {
    font-size: 0.8em;
    color: #a18aaf;
    margin: 0;
}

.flow-card:hover {
    transform: translateY(-5px);
    
    box-shadow: 0 5px 15px var(--shadow-hover);
}

.filter-menu {
    position: relative;
    display: inline-block;
}

.filter-button {
    display: flex;
    align-items: center;
    gap: 8px;
    background-color: var(--color-background-secondary); 
    border: none;
    color: var(--color-primary-text);
    font-size: 1em;
    padding: 10px 14px;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: background-color 0.3s, color 0.3s;
}

.filter-button::after {
    content: '\25BC';
    font-size: 0.7em;
    margin-left: 5px;
    transition: transform 0.3s;
}

.filter-button.active::after {
    transform: rotate(180deg);
}

.filter-content {
    display: none; 
    position: absolute;
    top: 100%; 
    left: 50%;
    transform: translateX(-50%); 
    background-color: var(--color-background-secondary);
    min-width: 600px;
    box-shadow: 0px 8px 16px rgba(0,0,0,0.2);
    z-index: 1000;
    max-height: 700px;
    overflow-y: auto;
    border: 1px dashed var(--color-border);
    border-radius:  var(--border-radius);
    padding: 10px;
    box-sizing: border-box;
}

.filter-content.show {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.filter-button i {
    font-size: 1.2em;
}

.filter-button span {
    font-size: 1em;
}

.filter-button:hover {
    background-color: var(--color-background-pattern);
}

.filter-button:active {
    transform: scale(0.98);
}

.controls {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    gap: 10px;
    background-color: var(--color-background-secondary);
    padding: 15px;
    border-radius: var(--border-radius);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.controls input,
.controls select,
.filter-button,
.toggle-button {
    padding: 10px 14px;
    /* border: 1px dashed var(--color-border); */
    border: none;

    background-color: var(--color-background);
    color: var(--color-primary-text);
    /* color: yellow; */
    border-radius: var(--border-radius);
    transition: background-color 0.3s, color 0.3s, border-color 0.3s;
    font-size: 0.875rem; /* 14px */
}

.controls input {
    flex: 1 1 200px;
    min-width: 200px;
}

.controls select {
    min-width: 150px;
}

.controls input {
    flex: 1 1 200px;
    min-width: 200px;
    border: none;
    border-bottom: 2px solid var(--color-border);
    background-color: var(--color-background);
    padding: 10px 14px;
    color: var(--color-primary-text);
    transition: border-color 0.3s, box-shadow 0.3s;
}

#searchInput {
    color: var(--color-primary-text);
}

.controls input:focus {
    outline: none;
    border-bottom: 2px solid var(--color-accent);
    box-shadow: 0 1px 0 var(--color-accent);
}

.category-tag {
    color: var(--color-primary-text);
    padding: 6px 12px;
    text-decoration: none;
    cursor: pointer;
    background-color: var(--color-background-pattern);
    border-radius: 20px;
    font-size: 0.9em;
    transition: background-color 0.3s, color 0.3s;
    text-align: center;
}

.category-tag:hover,
.category-tag.selected {
    background-color: var(--color-accent);
    color: #ffffff;
}

.favorite-button {
    position: absolute;
    right: 1px;
    background: transparent;
    border: none;
    color: var(--color-primary-text);
    font-size: 1.2em;
    pointer-events: auto;
    transition: color 0.3s;
    z-index: 2;
    padding: 4px;
}
.hidden-button {
    border: none;

    position: absolute;
    left: 1px;
    background: transparent;
    border: none;
    color: var(--color-primary-text);
    font-size: 1.2em;
    pointer-events: auto;
    transition: color 0.3s;
    z-index: 2;
    padding: 4px;
}
.favorite-button.favorited {
    color: var(--color-accent);
}

.favorite-button:hover {
    color: var(--color-accent);
}

.toggle-button#favoritesToggle {
    border: none;
    color: var(--color-primary-text);
    font-size: 1.2em;
    cursor: pointer;
    transition: color 0.3s;
    margin-left: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toggle-button#favoritesToggle.active {
    /* color: var(--color-accent); */
    color: var(--color-button-primary-active);
}

.toggle-button#favoritesToggle:hover {
    color: var(--color-button-primary-active);
    /* color: var(--color-button-primary); */
}

.toggle-button {
    border: none;
    /* color: var(--color-primary-text); */
    /* color: var(--color-accent); */
    color: var(--color-primary-text);
    font-size: 1.2em;
    cursor: pointer;
    transition: color 0.3s;
    margin-left: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toggle-button.active {
    color: var(--color-accent);
}

.toggle-button:hover {
    color: var(--color-accent);
}

.toggle-button:disabled {
    color: #888888;
    cursor: not-allowed;
}

@media (max-width: 1200px) {
    .right-col {
        width: 150px;
    }
}

@media (max-width: 992px) {
    .main-wrapper {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--color-border);
    }

    .content {
        padding: 10px 20px;
    }

    .controls {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-content {
        min-width: 100%;
    }

    .toggle-button#favoritesToggle {
        font-size: 1em;
        margin-left: 5px;
    }
}

.mid-col::-webkit-scrollbar {
    width: 8px;
}

.mid-col::-webkit-scrollbar-track {
    background: var(--color-scrollbar-track);
    border-radius: var(--border-radius);
}

.mid-col::-webkit-scrollbar-thumb {
    background-color: var(--color-primary);
    border-radius: var(--border-radius);
    border: 2px solid var(--color-scrollbar-track);
}

.mid-col::-webkit-scrollbar-thumb:hover {
    background-color: var(--color-highlight);
}

@keyframes animation-text {
    0% { opacity: 0; }
    40% { opacity: 0; }
    100% { opacity: 1; }
}

@keyframes animation-left {
    from { left: 30px; }
    to { left: -30px; }
}

@keyframes animation-right {
    from { right: 30px; }
    to { right: -30px; }
}

.appName {
    padding: 10px;
    color: var(--color-header-logo-text);
    border-top: 1px dashed var(--color-border);
    border-left: 1px dashed var(--color-border);
    border-right: 1px dashed var(--color-border);
    font-size: 12px;
}


.floating-update-character {
            position: fixed;
            /* top: -35px; */
            bottom: 60px;
            left: 40px;
            /* left: 44%; */
            width: 150px;
            height: 150px;
            cursor: pointer;
            z-index: 999;
            animation: floatIn 0.5s ease-out forwards, characterBob 3s ease-in-out infinite;
        }

        .floating-update-character .character-wrapper {
            position: relative;
            width: 100%;
            height: 100%;
        }

        .floating-update-character img {
            width: 100%;
            height: 100%;
            object-fit: contain;
            filter: drop-shadow(0 5px 15px rgba(0,0,0,0.3));
            transition: transform 0.3s ease;
        }

        .floating-update-character:hover {
            /* transform: scale(1.5); */
            animation-play-state: running;
        }
        .floating-update-character img:hover {
            transform: scale(1.08);
            transition: transform 0.3s ease;


        }
        .update-indicator {
            position: absolute;
            bottom: -1px;
            left: 0px;
            background: var(--color-button-primary);
            /* border-radius: 12px; */
            padding: 3px 8px;
            display: flex;
            align-items: center;
            gap: 4px;
            box-shadow: 0 2px 8px rgba(0,0,0,0.2);
            white-space: nowrap;
            font-size: 1.5em;
            border: 1px dashed var(--color-button-primary-active);
        }

        .update-dot {
            width: 6px;
            height: 6px;
            background: #fff;
            border-radius: 50%;
            animation: pulse 2s infinite;
        }

        .version-label {
            color: #fff;
            font-size: 0.7em;
            font-weight: bold;
        }

        @keyframes floatIn {
            from {
                transform: translateY(20px);
                opacity: 0;
            }
            to {
                transform: translateY(0);
                opacity: 1;
            }
        }

        @keyframes characterBob {
            0% {
                transform: translateY(0) scale(1);
            }
            50% {
                transform: translateY(-10px) scale(1);
            }
            100% {
                transform: translateY(0) scale(1);
            }
        }

        @keyframes pulse {
            0% {
                transform: scale(1);
                opacity: 1;
            }
            50% {
                transform: scale(1.5);
                opacity: 0.7;
            }
            100% {
                transform: scale(1);
                opacity: 1;
            }
        }
        
        @keyframes scaleOut {
        0% {
            /* transform: scale(1); */
            opacity: 1;
        }
        100% {
            /* transform: scale(1.2); */
            opacity: 0;
        }
    }
    @keyframes moveDownAndScale {
            0% {
                transform: translateY(0) scale(1);
                opacity: 1;
            }
            50% {
                transform: translateY(100px) scale(1);
                opacity: 1;
            }
            100% {
                transform: translateY(100px) scale(1.5);
                opacity: 0;
            }
        }


        @keyframes moveDown {
            0% {
                transform: translateY(0);
            }
            100% {
                transform: translateY(300px);
            }
        }

        @keyframes moveUp {
            0% {
                transform: translateY(0px);
            }
            100% {
                transform: translateY(-450px) translateX(860px);
            }
        }

.update-dialog-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    animation: fadeIn 0.3s ease-out;
}

.update-dialog-container {
    position: relative;
    display: flex;
    align-items: center;
    transform: translateY(40px);
    animation: floatUp 0.5s ease-out forwards;
    z-index: 2;

}

.update-character {
    position: absolute;
    /* left: 120px; */
    left: 30%;

    top: -196px; 
    width: 250px;
    height: 250px;
    z-index: 2;
    animation: characterBob 3s ease-in-out infinite;
}

.update-character img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 5px 15px rgba(0,0,0,0.3));
}

.update-dialog {
    background: linear-gradient(145deg, var(--color-background), var(--color-progress-background));
    padding: 25px 32px;
    min-width: 420px;
    max-width: 600px;
    backdrop-filter: blur(10px);
    border: 2px dashed var(--color-border)
}

.update-content h2 {
    color: var(--color-primary-text);
    margin: 0 0 15px 0;
    font-size: 1.5em;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.update-content p {
    color: var(--color-primary-text);
    margin: 8px 0;
    line-height: 1.4;
}

.version-info {
    font-size: 0.9em;
    color: #666;
    opacity: 0.8;
}

.update-actions {
    margin-top: 25px;
    display: flex;
    gap: 12px;
    align-items: center;
}

.update-now-btn {
    background: var(--color-button-primary);
    color: white;
    border: none;
    padding: 10px 24px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.update-now-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--color-progress-background);
}

.btn-icon {
    font-size: 1.2em;
    transition: transform 0.2s;
}

.update-now-btn:hover .btn-icon {
    transform: translateX(3px);
}

.remind-later-btn {
    background: transparent;
    border: none;
    color: #666;
    padding: 10px 20px;
    cursor: pointer;
    font-weight: 500;
    transition: color 0.2s;
}

.remind-later-btn:hover {
    color: var(--color-primary-text);
}

.close-dialog-btn {
    position: absolute;
    top: 15px;
    right: 20px;
    background: var(--color-button-primary);
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: var(--color-button-primary-text);
    transition: background 0.2s, transform 0.2s;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.close-dialog-btn:hover {
    background: white;
    transform: scale(1.1);
    color: var(--color-button-secondary-active);
}


@media (max-width: 600px) {
    .update-dialog {
        margin: 0 20px;
        padding: 20px;
        min-width: unset;
    }

    .update-character {
        width: 140px;
        height: 140px;
        left: -40px;
        top: -80px;
    }
}

/* Author Badge Styling */
.author-badge {
  display: flex;
  align-items: center;
  justify-content: left;
  /* background: var(--color-background); */
}
/* Avatar Container Styling */
.avatar-container {
  display: flex;
  margin-right: 10px;
  margin-left: 10px;
  margin-bottom: 10px;



}

.avatar-container img {
  width: 30px;
  height: 30px;
  border-radius: 50%; 
  object-fit: cover;
}





.author-name{
  font-size: 1em;
  margin: 0;
  /* background: red; */
  font-weight: bold;
  margin-bottom: 10px;

}


</style>
</head>
<body>
    <div class="container">
        <header></header>
        <div class="main-wrapper">
            <nav class="sidebar">
                <div class="menu-category">
                    <a href="/flow/linker" target="_blank"><span ><i class="fas fa-chain"></i>  Linker</span></a>
                    <a href="/" target="_blank"><span ><i class="fas fa-project-diagram"></i>  ComfyUI</span></a>
                <a href="/flow/fltuts" target="_blank"><span ><i class="fas fa-book-open"></i> Tutorials</span></a>
                <a href="/flow/fltuts" target="_blank"><span ><i class="fas fa-bell"></i> Updates</span></a>

                <!-- <span><i class="fas fa-cogs"></i> Settings</span> -->
                <!-- <div class="submenu">
                    <a href="#Preferences">Preferences</a>
                    <a href="#About">About</a>
                </div>                -->
                </div>
                <div id="theme-selector"></div>

            </nav>
            <div class="content">
                <div class="mid-col">
                    <div class="controls">
                        <input type="text" id="searchInput" placeholder="Search flows...">
                        <div class="filter-menu">
                            <button class="filter-button" id="filterButton">
                                <i class="fas fa-filter"></i>
                                <span>Filters</span>
                            </button>
                            <div class="filter-content" id="filterContent">
                                <!-- Category tags will be dynamically added here -->
                            </div>
                        </div> 
                        <select id="sortSelect">
                            <option value="nameAsc">Name (A-Z)</option>
                            <option value="nameDesc">Name (Z-A)</option>
                            <option value="categoryAsc">Category (A-Z)</option>
                            <option value="categoryDesc">Category (Z-A)</option>
                        </select>
                    </div>
                    <div class="flow-grid" id="flowGrid">
                        <!-- App cards will be dynamically added here -->
                    </div>
                </div>
            </div>
        </div>
        <footer>
            <p id="copyright"></p>
        </footer>
    </div>
    <script type="module">
        import { insertElement } from './core/js/common/components/header.js';
        import { initializeUI } from '/flow/js/main.js';
        document.addEventListener('DOMContentLoaded', () => {
            initializeUI();
            insertElement();
        });
    </script>
</body>
</html>